import yaml

from config import BAST_PATH


def real_yaml(filename):
    with open(filename,"r",encoding="utf-8") as f:
        data = yaml.safe_load(f)
        arrs = []
        for data in data.values():
            arrs.append((data.get("username"), data.get("password"),
                         data.get("expect"), data.get("toast_expect")))
        return arrs

def real1_yaml(filename):
    with open(filename,"r",encoding="utf-8") as f:
        data = yaml.safe_load(f)
        arrs = []
        for data in data.values():
            arrs.append((data.get("username"), data.get("password"),
                         data.get("shoujian_name"),data.get("phone_text"),
                         data.get("xiangxi_address_text"),data.get("youbain_text"),
                         data.get("expect"), data.get("toast_expect")))
        return arrs

def real2_yaml(filename):
    with open(filename, "r", encoding="utf-8") as f:
        data = yaml.safe_load(f)
        arrs = []
        for data in data.values():
            arrs.append((data.get("phone_xueche"), data.get("pwd_xueche"),
                         data.get("expect"), data.get("toast_expect")))

        return arrs





if __name__ == '__main__':
    filename = BAST_PATH + "/Data/xuechebu_login.yaml"
    res = real2_yaml(filename)
    print(res)


"""
1、组织数据源文件---单个值输入，直接使用列表格式；多个值输入我们需要把数据源文件组织成[{},{},{}]
2、多个值时需要把[{},{},{}]转换成({},{},{})
"""



